{% load i18n %}
<style>
    #buy_form span .svg {
        //float:left;
        cursor:text;
        width:14px;
        height:14px;
    }
    #buy_form .input-group-addon {
        width:42px
    }
    #buy_market_form span .svg {
        //float:left;
        cursor:text;
        width:14px;
        height:14px;
    }
    #buy_market_form .input-group-addon {
        width:42px
    }
</style>
<div id="trade_buy"></div>
<script id="temp_buy" type="text/html">
    <form class="form-horizontal" id="buy_form" method="post" role="form">
        {% csrf_token %}
        <input type="hidden" id="use_coin_type" name="use_coin_type" value="<%=coin1%>">
        <input type="hidden" id="coin_type" name="coin_type" value="<%=coin0%>">
        <input type="hidden" id="userid" name="userid" value="{{user.id}}">
        <input type="hidden" id="trade_type" name="trade_type" value="limit">

        <div class="form-group " style="padding-top:10px;">
            <label class="col-sm-offset-0 col-sm-4 col-xs-offset-1 col-xs-3 control-label green ">{% trans '买入' %} <%=coin0_info.name_upper%></label>
            <div class="col-sm-7 col-xs-7 ">
                <p class="control-label green ">{%trans '余额' %} <span id="buy_use_amount" class="f-fb">0.00</span> <%=coin1_info.name_upper%></p>
            </div>
        </div>
        <div class="form-group">
            <label for="buy_price" class="col-sm-offset-0 col-sm-3 col-xs-offset-1  col-xs-2 control-label">{% trans '价格' %}</label>
            <div class="col-sm-8 col-xs-8">
                <div class="input-group">
                    <span class="input-group-addon svg_green green"><%-$imports.get_coin_icon(coin1);%></span>
                    <input type="text" class="form-control " id="buy_price" name="price" title="{% trans '买入价格' %}" placeholder="{% trans '买入价格' %}">
                </div>
            </div>
        </div>
        <div class="form-group">
            <label for="lastname" class="col-sm-offset-0 col-sm-3 col-xs-offset-1 col-xs-2 control-label">{% trans '数量' %}</label>
            <div class="col-sm-8 col-xs-8">
                <div class="input-group">
                    <span class="input-group-addon svg_green green"><%-$imports.get_coin_icon(coin0);%></span>
                    <input type="text" class="form-control" id="buy_count" name="count" placeholder="{% trans '买入数量' %}">
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-offset-0 col-sm-3 col-xs-offset-1 col-xs-2 control-label"></label>
            <div class="col-sm-8 col-xs-8">
                <div id="h-slider">
                    <p id="buy_percent" class="form-control-static" align="right">60%</p>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-offset-0 col-sm-3 col-xs-offset-1 col-xs-2 control-label">{% trans '金额' %}</label>
            <div class="col-sm-8 col-xs-8">
                <div class="input-group">
                    <span class="input-group-addon svg_green green"><%-$imports.get_coin_icon(coin1);%></span>
                    <input type="text" class="form-control" id="buy_amount" placeholder="{% trans '交易金额' %}">
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-offset-1 col-sm-10 col-xs-offset-1 col-xs-10 ">
                {% if user.is_authenticated %}
                <button type="button" id="buy_button" class="btn btn-block btn-success" data-toggle="tooltip">{% trans '买入' %} <%=coin0_info.name_upper%></button>
                {% else %}
                <a href="/users/login?next=/{%url 'trade'%}" class="btn btn btn-block btn-success">{% trans '买入' %} <%=coin0_info.name_upper%></a>
                {% endif %}
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-1 col-xs-1 control-label"></label>
            <div class="col-sm-4 col-xs-4 ">
                <p class="form-control-static" id="buy_msg"></p>
            </div>
            <div class="col-sm-6 col-xs-6">
                <% var buy_fee = {{buy_fee}} * 100 %>
                <p class="control-label f-fr red">{% trans '买入交易费' %}:<span id="buy_rate"><%=buy_fee%></span>%</p>
            </div>
        </div>
    </form>
</script>

